/*Copyright ©2015 TommyLemon(https://github.com/TommyLemon)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.*/

package com.mego.megoandroid.model;


import com.alibaba.fastjson.JSONObject;

import zuo.biao.library.base.BaseModel;
import zuo.biao.library.util.JSON;


//sample
//结构 <=> Json

public class NoteInfo extends BaseModel {


    /**
     * ret : 200
     * data : {"title":"sss12122AA333","goods":"234234","version":"2.3.1","time":1543478500}
     * msg :
     */

    private int ret;
    private DataBean data;
    private String msg;

    public String toJSONString() {
        return JSON.toJSONString(this);
    }

    public static NoteInfo parseJson(String resultJson) {
        NoteInfo user = null;
        try {
            JSONObject data = JSON.parseObject(resultJson);
            if (data != null) {
                user = JSON.parseObject(data, NoteInfo.class);
            }
        } catch (Exception e1) {
            return null;
        }

        return user;
    }


    @Override
    protected boolean isCorrect() {//根据自己的需求决定，也可以直接 return true
        return id > 0;
    }

    public int getRet() {
        return ret;
    }

    public void setRet(int ret) {
        this.ret = ret;
    }

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static class DataBean {
        /**
         * title : sss12122AA333
         * goods : 234234
         * version : 2.3.1
         * time : 1543478500
         */

        private String title;
        private String goods;
        private String version;
        private int time;

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getGoods() {
            return goods;
        }

        public void setGoods(String goods) {
            this.goods = goods;
        }

        public String getVersion() {
            return version;
        }

        public void setVersion(String version) {
            this.version = version;
        }

        public int getTime() {
            return time;
        }

        public void setTime(int time) {
            this.time = time;
        }
    }
}
